package org.company.earth.arithmetic;

import java.util.LinkedList;

import org.company.earth.arithmetic.concept.Tree;

public class ZTree<T> implements Tree<T> {
	
	private TreeNode<T> root = null;
	private Integer depth = -1;
	
	public void initTree(){
		this.root = new TreeNode<T>();
		this.root.setParent(null);
		this.root.setChildren(new LinkedList<TreeNode<T>>());
		this.root.setData(null);
		this.depth = 0;
	}
	
	public void destroyTree(){
		this.root = null;
	}
	
	public void createTree(){
		
	}
	
	public void clearTree(){
		
	}
	
	public boolean emptyTree(){
		return true;
	}
	
	public int depthTree() {
		return 1;
	}
	
	public TreeNode<T> rootTree() {
		return null;
	}
	
	public T value(TreeNode<T> node){
		return null;
	}
	
	public void assign(TreeNode<T> node,T t){
	}
	
	public TreeNode<T> parent(TreeNode<T> node){
		return null;
	}
	
	public TreeNode<T> leftChild(TreeNode<T> node){
		return null;
	}
	
	public TreeNode<T> rightSibling(TreeNode<T> node){
		return null;
	}
	
	public void insertChild(TreeNode<T> node,int i,TreeNode<T> child){
		if(node.getChildren().size() < i) {
			//exception,node not exists;
		}
		node.getChildren().add(i, child);
	}
	
	public void insertChild(TreeNode<T> node, TreeNode<T> child) {
		this.insertChild(node, node.getChildren().size(), child);
	}
	
	public void deleteChild(TreeNode<T> node,int i){
		if(node.getChildren().size() < i) {
			//exception,node not exists
		}
		node.getChildren().remove(i);
	}
	
	public void deleteChild(TreeNode<T> node) {
		this.deleteChild(node, node.getChildren().size()-1);
	}
	
	public void traverseTree(){
		
	}
}
